#ifndef CSVFORMAT_H
#define CSVFORMAT_H


#include "outformat.h"
#include "stdffield.h"
#include <vector>
#include "chararray.h"

namespace opsrc {

    class CsvFormat : public OutFormat {
    public:
        CsvFormat();
        virtual ~CsvFormat();

        void out(RecBase* rec);
        void out(string& msg);
        void out(const char* msg);
        void out(int value);
        void out(float value);
        void out(long value);

        void open();
        void close();


    protected:
        void printHeaderInfo(RecBase* rec);
        void printFieldInfo(const char* name, StdfField<unsigned int>& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<int>& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<string>& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<long>& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<vector<bool> >& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<vector<int> >& f, long stdfRecStartBytePosition);
        void printFieldInfo(const char* name, StdfField<CharArray>& f, long stdfRecStartBytePosition);


    private:
        CsvFormat(const CsvFormat& orig);
        iostream* s;


    };

}

#endif // CSVFORMAT_H
